package com.itheima.controller;

import com.itheima.service.UserService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/user")
public class UserController {

    //注入Service
    // @Autowired 本地注入

    /*
        1. 从 zookeeper 注册中心获取 userService 的访问 url
        2. 进行远程调用 RPC
        3. 将结果封装为也给代理对象. 给变量赋值
     */
    @Reference
    private UserService userService;


    @RequestMapping("/sayHello")
    public String sayHello(){
        return userService.sayHello();
    }

}

